#!/usr/bin/env python3

from  runserver import app
from flask import request
from flask_restful import Resource
import time

db = app.get_db()
api = app.get_api()

class user(db.Model):
    __tablename__='user'
    user_id = db.Column(db.Integer, primary_key=True)
    user_name = db.Column(db.String)
    passwd = db.Column(db.String)
    department = db.Column(db.String)
    manager = db.Column(db.String)
    date = db.Column(db.Date)
'''
    def __init__(self,user_id,user_name,passwd,department,manager):
        self.user_id =user_id
        self.user_name = user_name
        self.passwd = passwd
        self.department =department
        self.manager = manager
'''

class userApi(Resource):
    def post(self):
        user_info = user(user_name=requeset.form['name'],passwd=request.form['pwd'],department=request.form['departmant'],manager=request.form['learder'],date=time.strftime('%Y%m%d'))
        print(user_info)
        db.session.add(user_info)
        db.session.commit()
        return "注册成功"

    def get(self):
        pass

    def put(self):
        pass

    def delete(self):
        pass

#api.add_resource(userApi,'/v1/api/register')



